﻿@namespace MudBlazor
@inherits MudComponentBase;

<div @ref="_root" @attributes="UserAttributes" class="@Class" style="@("outline-style: none;" + Style)" @onkeydown="OnRootKeyDown" @onkeyup="OnRootKeyUp" @onfocus="OnRootFocusAsync" tabindex="-1">

    <div style="pointer-events:none; position:fixed;"
         tabindex="@TrapTabIndex"
         @onfocus="OnTopFocusAsync">
    </div>

    <div @ref="_firstBumper"
         style="pointer-events:none; position:fixed;"
         tabindex="@TrapTabIndex"
         @onfocus="OnBumperFocusAsync">
    </div>

    <div @ref="_fallback"
         style="pointer-events:none; position:fixed;"
         tabindex="-1">
    </div>

    @ChildContent

    <div @ref="_lastBumper"
         style="pointer-events:none; position:fixed;"
         tabindex="@TrapTabIndex"
         @onfocus="OnBumperFocusAsync">
    </div>

    <div style="pointer-events:none; position:fixed;"
         tabindex="@TrapTabIndex"
         @onfocus="OnBottomFocusAsync">
    </div>

</div>

@code {
    string TrapTabIndex => (Disabled? "-1" : "0");
}